package com.inibb.app.vo.security;

import java.util.Collection;

import org.apache.commons.lang.builder.ToStringBuilder;

public class AuthorityDTO implements java.io.Serializable{

	private static final long serialVersionUID = 1L;
	

	private Integer id;

	private String name;

	private String displayName;
	
	private String displayNameKey;
	
	private String module;
	
	private String subModule;
	

	public String getModule() {
		return module;
	}
	public void setModule(String module) {
		this.module = module;
	}
	public String getSubModule() {
		return subModule;
	}
	public void setSubModule(String subModule) {
		this.subModule = subModule;
	}

	private boolean granted;

	public boolean isGranted() {
		return granted;
	}
	public boolean isGranted(Collection<AuthorityDTO> auths) {
		if(auths!=null){
			for(AuthorityDTO auth:auths){
				if(auth.id==id){
					return true;
				}
			}
		}
		return false;
	}
	public void setGranted(boolean granted) {
		this.granted = granted;
	}

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getDisplayName() {
		return displayName;
	}

	public void setDisplayName(String displayName) {
		this.displayName = displayName;
	}

	public String getDisplayNameKey() {
		return displayNameKey;
	}
	public void setDisplayNameKey(String displayNameKey) {
		this.displayNameKey = displayNameKey;
	}
	@Override
	public String toString() {
		return ToStringBuilder.reflectionToString(this);
	}
}
